package cn.baizhi.controller;


import cn.baizhi.service.StudentService;
import cn.baizhi.service.StudentTagService;
import cn.baizhi.vo.StudentDTO;
import cn.baizhi.vo.StudentDTO1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LZM
 * @since 2021-12-03
 */
@RestController
@RequestMapping("/students")
public class StudentController {

    @Autowired
    private StudentTagService studentTagService;

    @Autowired
    private StudentService studentService;


    @GetMapping
    public List<StudentDTO> selectAll() {
        return studentService.queryAll();
    }

    @PostMapping
    public ResponseEntity<StudentDTO> add(@RequestBody StudentDTO1 studentDto1){

        StudentDTO studentDTO = studentService.add(studentDto1);


        return new ResponseEntity<>(studentDTO,HttpStatus.OK);
    }
}

